import { RouteConfig } from '@/types/router'

export const filterAsyncRoute = (privateRouter: RouteConfig[], routes: string[]) => {
  return privateRouter.filter((item) => {
    if (routes.includes(item.meta?.permission!)) {
      if (item.children && item.children.length > 0) {
        item.children = filterAsyncRoute(item.children as RouteConfig[], routes)
      }
      return true
    }
  })
};
